package com.trafficsys.modules.loginAndRegister.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.trafficsys.modules.entity.Rule;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author Zhao Bin
 * @Date 2021/10/8 10:26
 * @Version 1.0
 */
@Mapper
@Repository
public interface RuleDao extends BaseMapper<Rule> {
    //根据罚单表的ruleId 集合的拼接字符串查询出所有
    @Select("select * from rule where id in (${ids})")
    List<Rule> getRulesById(@Param("ids") String ids);
    //给注册用户添加角色
    @Insert("insert into user_role_rel (card_id,role_id) values (#{cardId},#{roleId})")
    void addRoleForDriver(@Param("cardId")String cardId,@Param("roleId")String roleId);
}
